<style scoped src="./index.scss" lang="scss" rel="stylesheet/scss"></style>
<template src="./index.html"></template>
<script>
    export default {
        mixins: [Vue.prototype.$vFN.Mixins.Base],
        components: {},
        data() {
            return {
                // 1、阿里云OSS 2、腾讯云COS
                type:1,
                form: {
                    aliyunAccessKeyId: "",
                    aliyunAccessKeySecret: "",
                    aliyunBucketName: "",
                    aliyunEndpoint: "",
                    aliyunDomain: "",
                    aliyunPrefix: "",
                },
                // 页面接口地址
                apiUrl: {
                    detail: "mall-admin/oss-config/getItem",
                    save: "mall-admin/oss-config/getItem",
                },
            };
        },
        methods: {
           
            // 初始化
            init() {
                this.getData();
            },
           
            // 获取内容信息
            async getData() {
                let _data = await this.$vFN.Http.post({
                    url: this.apiUrl.detail,
                    data: {
                        type: this.type,
                    },
                });
                if (_data._ok) {
                    for(let i in this.form){
                        this.form[i] = _data.data[i]
                    }
                }
            },
           
            // 保存
            async submit() {
                let _data = await this.$vFN.Http.post({
                    url: this.apiUrl.detail,
                    data: {
                        type: this.type,
                    },
                });
                if (_data._ok) {
                    for(let i in this.form){
                        this.form[i] = _data.data[i]
                    }
                }
            },

        },
        mounted() {
            this.init();
        },
        activated() {},
    };
</script>